package net.pm.core.entities.db;

import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import net.pm.core.entities.PMCommandEntity;

import com.fasterxml.jackson.annotation.JsonIgnore;


/**
 * The persistent class for the pmdepartment database table.
 * PM部门实体类
 */
@Entity
@Table(name="pmdept")
public class Pmdept extends PMCommandEntity<Pmdept>  {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1966911942195069654L;
	private Integer id;
	private Date addTime;
	private String deptCode;
	private String deptDesc;
	private String deptName;
	private Set<Pmuser> pmusers;
	private Set<DeptPower> deptPowers;

    public Pmdept() {
    }

	public Pmdept(Integer id) {
		super();
		this.id = id;
	}



	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="Id", unique=true, nullable=false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}


    @Temporal( TemporalType.TIMESTAMP)
	@Column(name="AddTime", nullable=true)
	public Date getAddTime() {
		return this.addTime;
	}

	public void setAddTime(Date addTime) {
		this.addTime = addTime;
	}


	@Column(name="DeptCode", nullable=true, length=30)
	public String getDeptCode() {
		return this.deptCode;
	}

	public void setDeptCode(String deptCode) {
		this.deptCode = deptCode;
	}


	@Column(name="DeptDesc", nullable=true, length=200)
	public String getDeptDesc() {
		return this.deptDesc;
	}

	public void setDeptDesc(String deptDesc) {
		this.deptDesc = deptDesc;
	}


	@Column(name="DeptName", nullable=true, length=20)
	public String getDeptName() {
		return this.deptName;
	}

	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}


	//bi-directional many-to-one association to Pmuser
	@OneToMany(mappedBy="pmdept",fetch=FetchType.LAZY)
	@JsonIgnore
	public Set<Pmuser> getPmusers() {
		return this.pmusers;
	}

	public void setPmusers(Set<Pmuser> pmusers) {
		this.pmusers = pmusers;
	}
	
	

	//bi-directional many-to-one association to DeptPower
	@OneToMany(mappedBy="pmdept")
	public Set<DeptPower> getDeptPowers() {
		return this.deptPowers;
	}

	public void setDeptPowers(Set<DeptPower> deptPowers) {
		this.deptPowers = deptPowers;
	}


	@Override
	public int compareTo(Pmdept o) {
		// TODO Auto-generated method stub
		return 0;
	}
	
}